<template>
  <el-dialog title="记录" :visible.sync="dialogVisible" width="50%">
    <div class="tableList">
      <ws-table-el ref="table" v-bind="tableConfig">
        <template>
          <ws-table-column-el align="center" prop="name" label="下载人"></ws-table-column-el>
          <ws-table-column-el align="center" prop="downloadTime" label="下载时间"></ws-table-column-el>
        </template>
      </ws-table-el>
    </div>
    <span slot="footer" class="dialog-footer">
      <el-button @click="dialogVisible = false">返回</el-button>
    </span>
  </el-dialog>
</template>

<script>
export default {
  props: {
    value: {
      type: Boolean,
      default: false
    }
  },
  watch: {
    value(val) {
      this.dialogVisible = val
    },
    dialogVisible(val) {
      this.$emit('input', val)
    }
  },
  mounted() {},
  data() {
    return {
      dialogVisible: this.value,
      tableConfig: {
        filterColumns: false,
        loading: true,
        autoHeight: false,
        pageSizeList: [10],
        lazyQuery: {
          moduleName: '/home/fileDownload',
          op: {
            selectList: 'selectAccountAndPage',
            selectCount: 'selectAccountByCount'
          },
          beforeQuery: this.beforeSearch
        }
      }
    }
  },

  methods: {
    beforeSearch() {
      return {
        id: this.$attrs.id,
        fileType: this.$attrs.fileType
      }
    },
    search(type = 1) {
      this.$refs.table.search(type)
    }
  }
}
</script>

<style lang="scss" scoped>
::v-deep {
  .el-dialog__body {
    padding: 30px 0;
  }
  .ws-table-warp {
    min-height: 86%;
    padding: 0 !important;
    .empty-table {
      height: 300px !important;
    }
  }
  .el-dialog__footer {
    padding: 0;
    .el-button {
      width: 98px;
    }
    .el-button + .el-button {
      margin-left: 16px;
    }
  }
}
</style>
